/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package arc;

import com.arc.level.AbstractLevelState;
import com.arc.level.NetworkedNode;
import com.jme3.app.Application;
import com.jme3.app.state.AppStateManager;
import com.jme3.scene.Node;

/**
 *
 * @author Adam
 */
public class ClientLevelState extends AbstractLevelState{
    public ClientLevelState()
    {
        super(Type.Client, snapshotSize);
        
    }
    
    @Override
    public void initialize(AppStateManager am, Application app)
    {
        super.initialize(am, app);
        ArcClient client = (ArcClient)app;
        client.getRootNode().attachChild(levelRoot);
    }
    
    @Override
    public void update(float tpf)
    {
        interpolate(tpf);
    }
    
    private void interpolate(float tpf){
        //For now just make the most recent snapshot instantly apply.
        NetworkedNode node = getSnapshot(0).getRoot();
        Node root = node.toNodeTree();
        levelRoot = root;
    }
}
